﻿using System;

namespace Foreach
{
    class Program
    {
        static void Main(string[] args)
        {
            int sum = 0;

            int[] sums = new int[] { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 };

            foreach (int i in sums)
            {
                Console.WriteLine(i);

                sum = sum + i;
            }
            Console.WriteLine("数组总和为:" + sum);

            Console.ReadKey();
        }
    }
    }

